/*
**  File: Randomize_ansi.c
*/

#include <stdlib.h>
#include <time.h>
#include <stdio.h>
#include "Randomize_ansi.h"

/**************** Randomize ****************/

#define	kRandomUpperLimit	32768
#if ( kRandomUpperLimit != RAND_MAX+1 )
...code not valid...
#endif

/* BEGIN_EXTH */

int	Randomize( int range )
{
	long randomNumber;
	
	randomNumber = rand();
	return( (randomNumber * range) / kRandomUpperLimit );
}

/**************** RandomInit ****************/

void	RandomInit( void )
{
	unsigned int seed;
	seed = (unsigned int)time( NULL );
	srand( seed );
	printf( "rand seed %u\n", seed );
}
